package com.pontodroid;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MenuPrincipal extends Activity {
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_menu);
        
        inicializarComponentes();
	
    }
    
    public void inicializarComponentes(){
    	
    	Button btnIncluirMarcacao 	 = (Button) findViewById(R.button.telaMarcacao);
    	Button btnVizualizarCadastro = (Button) findViewById(R.button.telaUsuario);
    	Button btnRelatorios 		 = (Button) findViewById(R.button.telaRelatorios);
    	Button btnSair				 = (Button) findViewById(R.button.telaLogin);
    	
    	
    	btnIncluirMarcacao.setOnClickListener(new View.OnClickListener(){
    		
    		public void onClick(View arg0) {   			
    	        
    			Intent oActivity = new Intent(MenuPrincipal.this,TelaMarcacao.class);
    			MenuPrincipal.this.startActivity(oActivity);
    			
    		}   		
    		    		
    	});     
    	
    	btnVizualizarCadastro.setOnClickListener(new View.OnClickListener(){
    		
    		public void onClick(View arg0) {   			
    	        
    			Intent oActivity = new Intent(MenuPrincipal.this,TelaUsuario.class);
    			MenuPrincipal.this.startActivity(oActivity);
    		
    		}   		
    		    		
    	});   
    	
    	btnRelatorios.setOnClickListener(new View.OnClickListener(){
    		
    		public void onClick(View arg0) {   			
    	        
    			Intent oActivity = new Intent(MenuPrincipal.this,ListaMarcacoes.class);
    			MenuPrincipal.this.startActivity(oActivity);
    		
    		}   		
    		    		
    	});   
    	
    	btnSair.setOnClickListener(new View.OnClickListener(){
    		
    		public void onClick(View arg0) {   			
    	        
    			finish();  
    		
    		}   		
    		    		
    	});     	
    
    }
    
    public String GetResposta(String Parametros){
    	
   	 HttpClient hc = new DefaultHttpClient();
        HttpPost post = new HttpPost("http://genericus-furb.appspot.com/logon?name=patrick&password=patrick");
        //post.setEntity(new UrlEncodedFormEntity(nameValuePairs, HTTP.UTF_8));
        HttpResponse rp = null;
        try{
        	rp = hc.execute(post);
        	return rp.toString();
        }catch(Exception e){
       	 
       	 e.printStackTrace();
       	 return "erro";
        }
    }

}
